# 字典练习
def dict_test():
     # 创建字典
     dict_1 = {'name': 'alex', 'age': 18, 'sex': 'male'}
     print(dict_1)

     # 访问字典元素
     print(dict_1['name'])

     # 添加元素
     dict_1['city'] = 'beijing'
     print(dict_1)

     # 修改元素
     dict_1['age'] = 19
     print(dict_1)

     # 删除元素
     del dict_1['age']
dict_test()